#ifndef UPDATER_H
#define UPDATER_H

#include <QObject>
#include <QByteArray>
#include <QString>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QFile>
#include <QDebug>
#include <QByteArray>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonValue>
#include <QJsonArray>
#include <QMessageBox>
#include <QDir>
#include <QProcess>
#include <QApplication>
#include "taskitem.h"


class Updater : public QObject
{
    Q_OBJECT

public:
    QNetworkAccessManager *m_manager;

    QFile *m_updateTempFile;
    QByteArray m_html;
    QJsonDocument m_jsonDoc;
    // 项目地址
    QString m_serverAddress;
    QString m_check_url;

    QString m_new_version;
    QString m_new_describe;
    QString m_new_datetime;

    // 下载压缩文件
    QString m_download_url;
    QString m_downloadFileName;

    // 更新程序路径
    QString m_program;
public:
    explicit Updater(QObject *parent = nullptr);
    ~Updater();

    void checkVersion(QWidget *parent, QString version);

    bool isNewest(QString version);

    void startUpdateProcess();

signals:

};

#endif // UPDATER_H
